Programming Languages Section

The Perl Programming Language

Card image
Post by Amina Delali, November 10th,2021

Some Facts

Perl is a cross-platform high-level interpreted language used in web development and system administration. The language is object-oriented, procedural and functional. He also has powerful tools for text processing . Perl is related to another language from the same family, Perl 6 which was later named Raku, and the 2 languages are still in developpement. The language is also characterized by its modules that extend Perl capabilities with new variables and subroutines that accomplish specific tasks . It has over 25.000 modules that you can find in the Comprehensive Perl Archive Network ( CPAN).



How to install it

  • on Windows:
    1. Download and run the installer for the Padre Perl editor that comes with Strawberry Perl ( Perl Environment for Ms Windows ).
    2. Log out and log in again. Or you can simply reboot your system.
    3. Open the Perl command line ( a link in the start menu ) and type in the following command to check the installation: perl -v
    4. Install the cpanm tool with the following command: cpan App::cpanminus
  • on ubuntu :

    You may have Perl already installed in your system. If it is not the case, simply follow the next steps to install it:

    1. Open the terminal and run the following commands: sudo apt update
      sudo apt install perl
    2. To check the installation use this command: perl -v
    3. You may want to install the cpanm tool (for future Perl modules installation): sudo cpan App::cpanminus If you are prompted for automatic or manual configuration for cpanm just hit the return button for automatic configuration . If you get to select the strategy to handle privileges issues, you can select sudo strategy.

The Hello World Example

    For your first code in Perl on Ubuntu, just follow these steps:

    1. Create a new file in the home folder with the name hello.pl
    2. Open the file and add the following code: 
      #!/usr/bin/perl
      use strict;
      use warnings;

      print("Hello World!\n");
    3. To run your code, open the terminal from the home folder, and run the following command:perl hello.pl
    4. You can also run it this way: chmod 700 hello.pl
      ./hello.pl


Additional Information

For more information about the Perl language and the corresponding code, you can check the following pages:

Something to say ?

If you want to add something about the language or about this post, please feel free to do it by commenting below 🙂 .